import 'package:three_js/three_js.dart' as three;

// 打光
mixin LightHelper {
  // 普通
  getCustomLight() {
    // 环境光
    final ambientLight = three.AmbientLight(0x404040);
    ambientLight.castShadow = true;
    // 平行光（sun light）
    final directionalLight = three.DirectionalLight(0xffffff, 0.8);
    // 从右上角照射
    directionalLight.position = three.Vector3(1, 1, 1);
    directionalLight.castShadow = true;
    // 半球光（模拟天空和地面反射）
    final hemisphereLight = three.HemisphereLight(0xffffbb, 0x080820, 0.5);
    hemisphereLight.castShadow = true;
    return (ambientLight, directionalLight, hemisphereLight);
  }

  // PBR
  getPBRLight() {
    // 环境光（低强度）
    final ambientLight = three.AmbientLight(0x404040, 0.2);
    ambientLight.castShadow = true;
    // 平行光（主光源）
    final dirLight = three.DirectionalLight(0xffffff, 0.5);
    dirLight.position = three.Vector3(5, 10, 7);
    dirLight.castShadow = true;
    // 点光源（模拟灯泡/局部光）
    final pointLight = three.PointLight(0xffaa00, 1, 50);
    pointLight.position = three.Vector3(-5, 3, 0);
    pointLight.castShadow = true;
    return (ambientLight, dirLight, pointLight);
  }
}
